package com.yzion.demo_swipeback.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;

import com.yzion.baseapp.R;
import com.yzion.demo_swipeback.BaseSwipeBackFragment;


/**
 * Created by YoKeyword on 16/4/19.
 */
public class FirstSwipeBackFragment extends BaseSwipeBackFragment {
    private Toolbar mToolbar;

    public static FirstSwipeBackFragment newInstance() {

        Bundle args = new Bundle();

        FirstSwipeBackFragment fragment = new FirstSwipeBackFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public boolean isUseDefaultTitleBar() {
        return true;
    }

    @Override
    public View setContentView(@NonNull LayoutInflater inflater, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_swipe_back_first, null);
        return view;
    }


    @Override
    public void initView() {

//        TitleBarView titleBarView = getDefaultTitleBar();
//        titleBarView.setMode(TitleBarView.MODE_BACKPRESS);
//        titleBarView.setTitle("FirstSwipeBackFragment");
//        titleBarView.setLeftIcon(R.drawable.ic_back_white);

//        mDefaultToolbar = findViewById(R.id.toolbar);
//        mDefaultToolbar.setTitle("SwipeBackActivity的Fragment");
//        initToolbar(mDefaultToolbar);

        findViewById(R.id.tv_btn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mAddFragmentListener != null) {
                    mAddFragmentListener.onAddFragment(FirstSwipeBackFragment.this, SecondSwipeBackFragment.newInstance());
                }
            }
        });
        findViewById(R.id.tv_loading).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                showLoading("正在加载中");

//                mRootView.postDelayed(new Runnable() {
//                    @Override
//                    public void run() {
//                        hideLoading();
//                    }
//                }, 3000);
            }
        });
    }

    @Override
    public void initData() {

    }


}
